/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package auctions;

import java.util.Arrays;


/**
 *
 * @author hangsu
 */
public class BidderResult {
    
    private int bidderIdx;
    private boolean[] itemsWon;
    private double[] winPrices;
    private double cost;
    private double util;
    
    public BidderResult(int idx, int auctionNum) {
        this.bidderIdx=idx;
        this.itemsWon=new boolean [auctionNum];
        Arrays.fill(this.itemsWon, false);
        this.winPrices=new double [auctionNum];
        this.cost=0;
        this.util = -1;
    }
    
    public void addWinning(int auctionIdx, double price) {
        this.cost+=price;
        this.itemsWon[auctionIdx]=true;
        this.winPrices[auctionIdx]=price;
    }
    
    public int getIdx() {
        return this.bidderIdx;
    }
	
    public boolean[] getItemsWon() {
        return this.itemsWon;
    }
    
    public double[] getWinPrices() {
        return this.winPrices;
    }
    
    public double getCost() {
        return this.cost;
    }
    
    public double getUtil() {
        return this.util;
    }
    
    public double getProfit() {
        return this.util-this.cost;
    }
    
    public void setUtil(double utility) {
        this.util=utility;
    }
    
    public void clear() {
        Arrays.fill(this.itemsWon, false);
        this.cost=0;        
    }
    
}
